//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Documents
//  File name:	IDocConverter.cs
//  Developer:	Solomatov Igor
//  Created:	16.04.2012
// 
//  -------------------- iSharePoint -------------------- //

using System.Collections.Generic;
using Microsoft.SharePoint;

namespace Smart.Documents.Services
{
	public interface IDocConverter
	{
		/// <summary>
		/// Extract extension from file url
		/// </summary>
		string GetExtension(string source);

		/// <summary>
		/// Return extension for <paramref name="format"/>
		/// </summary>
		string GetExtension(FileFormat format);

		/// <summary>
		/// Return format for file url
		/// </summary>
		FileFormat GetFormat(string source);

		/// <summary>
		/// Checks whether conversion is required, to save file in specified format
		/// </summary>
		bool IsConversionRequired(string source, FileFormat format);

		/// <summary>
		/// Queue conversion job for all source files
		/// </summary>
		DocConversionJobInfo QueueFileConversionJob(SPSite site, FileFormat format, bool recycle, params string[] sourceFiles);

		/// <summary>
		/// Queue conversion job for all source files
		/// </summary>
		DocConversionJobInfo QueueFileConversionJob(SPSite site, FileFormat format, bool recycle, params SPFile[] sourceFiles);

		/// <summary>
		/// Queue conversion job for all source files
		/// </summary>
		DocConversionJobInfo QueueFolderConversionJob(SPSite site, FileFormat format, bool recycle, params string[] sourceFolders);

		/// <summary>
		/// Queue conversion job for all source files
		/// </summary>
		DocConversionJobInfo QueueFolderConversionJob(SPSite site, FileFormat format, bool recycle, params SPFolder[] sourceFolders);

		/// <summary>
		/// Queue conversion job for all source files
		/// </summary>
		DocConversionJobInfo QueueConversionJob(SPSite site, IEnumerable<string> sourceFiles, IEnumerable<string> sourceFolders, FileFormat format, bool recycle);

		/// <summary>
		/// Checks whether conversion job completed
		/// </summary>
		bool CheckConversionJobCompleted(DocConversionJobInfo info);

		/// <summary>
		/// Handles conversion job completion (update status, recycle source items)
		/// </summary>
		void HandleConversionJobCompletion(DocConversionJobInfo info);

		/// <summary>
		/// Wait until conversion succeeds
		/// </summary>
		void WaitConversion(DocConversionJobInfo info);
	}
}